package com.ruoyi.gams.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.gams.mapper.GamsWindowMapper;
import com.ruoyi.gams.domain.GamsWindow;
import com.ruoyi.gams.service.IGamsWindowService;

/**
 * 窗口Service业务层处理
 *
 * @author ruoyi
 * @date 2021-09-03
 */
@Service
public class GamsWindowServiceImpl implements IGamsWindowService
{
    @Autowired
    private GamsWindowMapper gamsWindowMapper;

    /**
     * 查询窗口
     *
     * @param id 窗口主键
     * @return 窗口
     */
    @Override
    public GamsWindow selectGamsWindowById(Integer id)
    {
        return gamsWindowMapper.selectGamsWindowById(id);
    }

    /**
     * 查询窗口列表
     *
     * @param gamsWindow 窗口
     * @return 窗口
     */
    @Override
    public List<GamsWindow> selectGamsWindowList(GamsWindow gamsWindow)
    {
        return gamsWindowMapper.selectGamsWindowList(gamsWindow);
    }

    /**
     * 新增窗口
     *
     * @param gamsWindow 窗口
     * @return 结果
     */
    @Override
    public int insertGamsWindow(GamsWindow gamsWindow)
    {
        gamsWindow.setCreateTime(DateUtils.getNowDate());
        return gamsWindowMapper.insertGamsWindow(gamsWindow);
    }

    /**
     * 修改窗口
     *
     * @param gamsWindow 窗口
     * @return 结果
     */
    @Override
    public int updateGamsWindow(GamsWindow gamsWindow)
    {
        return gamsWindowMapper.updateGamsWindow(gamsWindow);
    }

    /**
     * 批量删除窗口
     *
     * @param ids 需要删除的窗口主键
     * @return 结果
     */
    @Override
    public int deleteGamsWindowByIds(Integer[] ids)
    {
        return gamsWindowMapper.deleteGamsWindowByIds(ids);
    }

    /**
     * 删除窗口信息
     *
     * @param id 窗口主键
     * @return 结果
     */
    @Override
    public int deleteGamsWindowById(Integer id)
    {
        return gamsWindowMapper.deleteGamsWindowById(id);
    }

    @Override
    public GamsWindow findFirstByName(String name)
    {
        return gamsWindowMapper.findFirstByName(name);
    }
    @Override
    public GamsWindow findFirstByStaffId(Integer id)
    {
        return gamsWindowMapper.findFirstByStaffId(id);
    }

    @Override
    public int updateStaffIdAndStaffNameById(Integer updatedStaffId, String updatedStaffName, Integer id)
    {
        return gamsWindowMapper.updateStaffIdAndStaffNameById(updatedStaffId, updatedStaffName, id);
    }
}
